home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / JFC.bin / Element.java < prev    next >
Text File  |  1998-06-30  |  3KB  |  116 lines

  1. /*
  2.  * @(#)Element.java    1.11 98/04/09
  3.  * 
  4.  * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  */
  20. package com.sun.java.swing.text;
  21.  
  22. /**
  23.  * Interface to describe a structural piece of a document.  It
  24.  * is intended to capture the spirit of an SGML element.
  25.  *
  26.  * @author  Timothy Prinzing
  27.  * @version 1.11 04/09/98
  28.  */
  29. public interface Element {
  30.  
  31.     /**
  32.      * Fetches the document associated with this element.
  33.      *
  34.      * @return the document
  35.      */
  36.     public Document getDocument();
  37.  
  38.     /**
  39.      * Fetches the parent element.  If the element is a root level
  40.      * element returns null.
  41.      *
  42.      * @return the parent element
  43.      */
  44.     public Element getParentElement();
  45.  
  46.     /**
  47.      * Fetches the name of the element.  If the element is used to
  48.      * represent some type of structure, this would be the type
  49.      * name.  
  50.      *
  51.      * @return the element name
  52.      */
  53.     public String getName();
  54.  
  55.     /**
  56.      * Fetches the collection of attributes this element contains.
  57.      *
  58.      * @return the attributes for the element
  59.      */
  60.     public AttributeSet getAttributes();
  61.  
  62.     /**
  63.      * Fetches the offset from the beginning of the document
  64.      * that this element begins at.  If this element has
  65.      * children, this will be the offset of the first child.
  66.      *
  67.      * @return the starting offset >= 0
  68.      */
  69.     public int getStartOffset();
  70.  
  71.     /**
  72.      * Fetches the offset from the beginning of the document
  73.      * that this element ends at.  If this element has
  74.      * children, this will be the end offset of the last child.
  75.      *
  76.      * @return the ending offset >= 0
  77.      */
  78.     public int getEndOffset();
  79.  
  80.     /**
  81.      * Gets the child element index closest to the given offset.
  82.      * The offset is specified relative to the begining of the
  83.      * document. 
  84.      *
  85.      * @param offset the specified offset >= 0
  86.      * @return the element index >= 0
  87.      */
  88.     public int getElementIndex(int offset);
  89.  
  90.     /**
  91.      * Gets the number of child elements contained by this element. 
  92.      * If this element is a leaf, a count of zero is returned.
  93.      *
  94.      * @return the number of child elements >= 0
  95.      */
  96.     public int getElementCount();
  97.  
  98.     /**
  99.      * Fetches the child element at the given index.
  100.      *
  101.      * @param index the specified index >= 0
  102.      * @return the child element
  103.      */
  104.     public Element getElement(int index);
  105.  
  106.     /**
  107.      * Is this element a leaf element?
  108.      *
  109.      * @return true if a leaf element else false
  110.      */
  111.     public boolean isLeaf();
  112.  
  113.  
  114. }
  115.  
  116.